package com.huiyeji.dynamic.core.bean;

import com.huiyeji.dynamic.core.annotations.*;

import java.util.UUID;

@DynamicBean("string")
public class DynamicString {

    @DynamicMethod
    public Integer toInteger(String s) {
        return Integer.parseInt(s);
    }

    @DynamicMethod
    public Boolean toBoolean(String s) {
        return Boolean.parseBoolean(s);
    }

    @DynamicMethod
    public Long toLong(String s) {
        return Long.parseLong(s);
    }

    @DynamicMethod
    public String of(Object s){
        return s.toString();
    }

    @DynamicMethod
    public String uuid(){
        return UUID.randomUUID().toString().replace("-","");
    }
}
